let b = ";我’;是’;好’;人’"
let key1 = ";"
let key2 = "’"

function interceptDifferentChar(key1, key2, value) {
    if (value) {
        let num1
        let num2
        let arr1 = []
        let arr2 = []
        for (let i = 0; i < value.length; i++) {
            if (value.indexOf(key1, num1) != -1) {
                arr1.push(value.indexOf(key1, num1))
                num1 = value.indexOf(key1, num1) + 1
            }
            if (value.indexOf(key2, num2) != -1) {
                arr2.push(value.indexOf(key2, num2))
                num2 = value.indexOf(key2, num2) + 1
            }
        }
        let res = ""
        arr1.forEach((e, index) => {
            res += value.slice(e+1, arr2[index])
        });
    console.log(res, "截取特定字符串中间的内容");
    }
}
interceptDifferentChar(key1, key2, b)

function interceptSameChar(key, value) {
    if (value) {
        let num
        let arr = []
        for (let i = 0; i < value.length; i++) {
            if (value.indexOf(key, num) != -1) {
                arr.push(value.indexOf(key, num))
                num = value.indexOf(key, num) + 1
            }
        }
        let res = ""
        arr.forEach((e, index) => {
            if (index%2 == 0) {
                res += value.slice(e+1, arr[index+1])
            }
        });
    console.log(res, "截取特定字符串中间的内容");
    }
}
interceptSameChar("'", "'我'大苏打'是'daada'好''人'")